from openai import OpenAI

API_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1"  # 替换为实际值
API_KEY = "sk-6bf84288ecdc45298ef47b7c28380766"  # 替换为实际值

client = OpenAI(api_key=API_KEY, base_url=API_BASE_URL)

try:
    response = client.chat.completions.create(
        model="qwen-turbo-2024-06-24",  # 替换为目标模型名称
        messages=[{"role": "user", "content": "测试请求"}],
    )
    print("API调用成功:", response.choices[0].message.content)
except Exception as e:
    print("API调用失败:", str(e))